package cn.xm.basic.result;

public class AjaxResult {

    private Boolean success = true;
    private String message = "执行成功";
    private Object resultObj;

    public Object getResultObj() {
        return resultObj;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    public AjaxResult(Boolean success, String message, Object resultObj) {
        this.success = success;
        this.message = message;
        this.resultObj = resultObj;
    }

    public AjaxResult() {
    }

    public AjaxResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public static AjaxResult me() {
        return new AjaxResult();
    }

    public AjaxResult fail(String message) {
        this.setSuccess(false);
        this.message = message;
        return this;
    }

    public Boolean getSuccess() {
        return success;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                '}';
    }
}
